package com.liu.susu.controller;

import com.liu.susu.dao.DogDao2;
import com.liu.susu.pojo.Dog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@Controller
@RequestMapping("/dog/dao2")
public class DogDao2Controller {
    @Autowired
    private DogDao2 dogDao2;

    @ResponseBody
    @RequestMapping("/list")
    private List<Dog> getDogList(){
        List<Dog> dogList = dogDao2.getDogList();
        return dogList;
    }
    @ResponseBody
    @RequestMapping("/list2")
    private List<Dog> getDogList2(){
        List<Dog> dogList = dogDao2.getDogList2();
        return dogList;
    }
    @ResponseBody
    @RequestMapping("/objList")
    private List<Object[]> getDogObjectList(){
        List<Object[]> dogObjectList = dogDao2.getDogObjectList();
        return dogObjectList;
    }
    @ResponseBody
    @RequestMapping("/list3")
    private List<Dog> getDogList3(){
        List<Dog> dogList = dogDao2.getDogList3();
        return dogList;
    }
    /**
     * 根据条件查询
     * @param dogAge
     * @return
     */
    @ResponseBody
    @RequestMapping("/listByDogAge")
    private List<Dog> getDogListByParam(@RequestParam int dogAge){
        List<Dog> dogList = dogDao2.getDogList0(dogAge);
        return dogList;
    }

}
